package debby.bdmap.utils

import com.baidu.mapapi.map.Overlay

/**
 * Created by debby on 2018/6/15.
 * 描述:图形管理类
 */
const val OneMark = "OneMark"
const val OneLine = "OneLine"
const val OnePolygon = "OnePolygon"
const val OneText = "OneText"
const val One = "One"

val OverlayMap = HashMap<String, Overlay>()

/**
 *移除绘制图形
 * @param key 图层标签
 */
fun removeOverlay(key: String) {
    if (OverlayMap[key] != null) {
        val old = OverlayMap[key] as Overlay
        old.remove()
    }
}

/**
 *增加绘制图形
 * @param key 图层标签
 */
fun addOverlay(key: String, overlay: Overlay) {
    OverlayMap[key] = overlay
}

/**
 * 清除所有
 */
fun removeAll() {
    for (mutableEntry in OverlayMap) {
        mutableEntry.value.remove()
    }
}